package cn.gson.springboot.model.pjos;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Objects;

@Entity
public class Programme {
    private int programmeId;//方案id
    private String programmeTitle;//方案主题
    private String programmeContent;//方案内容
    private String customerFeedback;//客户反馈
    private Timestamp programmeTime;//制定时间
    private BusinessInfo businessInfoByBusinesId;//对应商机
    private Customer customerByCustomId;//对应客户
    private String programmeStauts;//方案状态
    private  Emp programmeEmp;//方案制定人

    @ManyToOne
    @JoinColumn(name = "programme_emp" ,referencedColumnName = "employees_id")
    public Emp getProgrammeEmp() {
        return programmeEmp;
    }
    public void setProgrammeEmp(Emp programmeEmp) {
        this.programmeEmp = programmeEmp;
    }

    @Id
    @Column(name = "programme_id")
    public int getProgrammeId() {
        return programmeId;
    }

    public void setProgrammeId(int programmeId) {
        this.programmeId = programmeId;
    }

    @Basic
    @Column(name = "programme_title")
    public String getProgrammeTitle() {
        return programmeTitle;
    }

    public void setProgrammeTitle(String programmeTitle) {
        this.programmeTitle = programmeTitle;
    }

    @Basic
    @Column(name = "programme_content")
    public String getProgrammeContent() {
        return programmeContent;
    }

    public void setProgrammeContent(String programmeContent) {
        this.programmeContent = programmeContent;
    }

    @Basic
    @Column(name = "customer_feedback")
    public String getCustomerFeedback() {
        return customerFeedback;
    }

    public void setCustomerFeedback(String customerFeedback) {
        this.customerFeedback = customerFeedback;
    }

    @Basic
    @Column(name = "programme_time")
    public Timestamp getProgrammeTime() {
        return programmeTime;
    }

    public void setProgrammeTime(Timestamp programmeTime) {
        this.programmeTime = programmeTime;
    }


    @Basic
    @Column(name = "programme_stauts")
    public String getProgrammeStauts() {
        return programmeStauts;
    }

    public void setProgrammeStauts(String programmeStauts) {
        this.programmeStauts = programmeStauts;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Programme programme = (Programme) o;
        return programmeId == programme.programmeId &&
                Objects.equals(programmeTitle, programme.programmeTitle) &&
                Objects.equals(programmeContent, programme.programmeContent) &&
                Objects.equals(customerFeedback, programme.customerFeedback) &&
                Objects.equals(programmeTime, programme.programmeTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(programmeId, programmeTitle, programmeContent, customerFeedback, programmeTime);
    }

    @ManyToOne
    @JoinColumn(name = "busines_id", referencedColumnName = "busines_id")
    public BusinessInfo getBusinessInfoByBusinesId() {
        return businessInfoByBusinesId;
    }

    public void setBusinessInfoByBusinesId(BusinessInfo businessInfoByBusinesId) {
        this.businessInfoByBusinesId = businessInfoByBusinesId;
    }

    @ManyToOne
    @JoinColumn(name = "custom_id", referencedColumnName = "custom_id")
    public Customer getCustomerByCustomId() {
        return customerByCustomId;
    }

    public void setCustomerByCustomId(Customer customerByCustomId) {
        this.customerByCustomId = customerByCustomId;
    }

    /*@Override
    public String toString() {
        return "Programme{" +
                "programmeId=" + programmeId +
                ", programmeTitle='" + programmeTitle + '\'' +
                ", programmeContent='" + programmeContent + '\'' +
                ", customerFeedback='" + customerFeedback + '\'' +
                ", programmeTime=" + programmeTime +
                ", businessInfoByBusinesId=" + businessInfoByBusinesId +
                ", customerByCustomId=" + customerByCustomId +
                ", programmeStauts='" + programmeStauts + '\'' +
                '}';
    }*/
}
